package com.xiaoshuidi.cloud.module.member.enums;

import cn.hutool.core.lang.Assert;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum ActivitiesEnrollStaticsEnum {
    ENROLLMENT("1", "报名人数"),
    VERIFIED("2", "已核销人数"),
    TO_BE_VERIFIED("3", " 待核销人数");
    private String code;
    private String name;

    //
    public static String getNameByCode(String code) {
        ActivitiesEnrollStaticsEnum activitiesEnrollStaticsEnum = Arrays.stream(ActivitiesEnrollStaticsEnum.values()).filter(p -> p.code.equals(code)).findFirst().orElse(null);
        Assert.isTrue(activitiesEnrollStaticsEnum != null, "ActivitiesEnrollStaticsEnum:{}不存在", code);
        return activitiesEnrollStaticsEnum.getName();
    }
}
